package com.herohead;

import java.io.IOException;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

public class Rabbit_publish {

	ConnectionFactory factory = new ConnectionFactory();
	public Connection connection;
	public Channel channel;
	public String hostName;


	public void closeChannel() throws IOException {
		channel.close();
	}

	public String getHostname() {
		return factory.getHost();
	}

	public void setHostname(String strHostname) {
		factory.setHost(strHostname);
	}

	public void setLogin (String vHost, String vPassword, String vUsername) {
		factory.setVirtualHost(vHost);
		factory.setPassword(vPassword);
		factory.setUsername(vUsername);
	}

	public Channel setupChannel() throws IOException {
		connection = factory.newConnection();
		channel = connection.createChannel();
		return channel;
	}

}